package it.prova.uml.value;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException;

import sun.java2d.loops.CompositeType;


public abstract class AbstractMetaDataEnabledFeature implements IMetaDataEnabledFeature {
@SuppressWarnings("rawtypes")
private List validationMessages;
	
	/**
	 * An empty list
	 */
	@SuppressWarnings("rawtypes")
	protected static List EMPTY_LIST = new ArrayList(0);
	
	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#getValidationMessages()
	 */
	@SuppressWarnings("rawtypes")
	public List getValidationMessages() {
		if (validationMessages == null){
			validationMessages = new ArrayList();
		}
		return validationMessages;
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IDefaultValue#getDefaultValue()
	 */
	public String getDefaultValue() {
		return null;		
	}
	
	/**
	 * @return possible values of type as list of Strings using 
	 * {@link IPossibleValues}.POSSIBLE_VALUES_PROP_NAME trait name
	 */
	@SuppressWarnings("rawtypes")
	protected List getMDPossibleValues() {
		return null;
	}
	
	/**
	 * @return possible values of type to dislay as list of Strings using 
	 * {@link IPossibleValues}.POSSIBLE_VALUES_FOR_DISPLAY_PROP_NAME trait name
	 */
	@SuppressWarnings("rawtypes")
	protected List getMDPossibleValuesForDisplay() {
		return null;
	}
	
	/**
	 * @return  list of valid values as list of Strings using 
	 * {@link IValidValues}.VALID_VALUES_PROP_NAME trait name
	 */
	@SuppressWarnings("rawtypes")
	protected List getMDValidValues() {
		return null;
	}
	
	/**
	 * @return Validation message for type using
	 * {@link IValidValues}.VALID_VALUES_MESSAGE_PROP_NAME trait name
	 */
	protected String getMDValidationMessage() {
		return null;			
	}

	/**
	 * @return Validation severity int value for type using
	 * {@link IValidValues}.VALID_VALUES_SEVERITY_PROP_NAME trait name
	 */
	protected int getMDValidationSeverity() {
		return 0;
	}

	/**
	 * @return Validation code as String value for type using
	 * {@link IValidValues}.VALID_VALUES_CODE_PROP_NAME trait name
	 */
	protected String getMDValidationCode() {
		return null;
	}
	
	/**
	 * Create a {@link ValidationMessage} from metadata or use default message
	 * and add it to the collection of validation messages
	 * @param defaultMsg
	 */
	protected void addNewValidationMessage(String defaultMsg) {
		return;
	}
	
	/**
	 * @return the value of {@link org.eclipse.jst.jsf.common.internal.types.IAssignable}.ASSIGNMENT_TYPE_NONE.  Subclasses to override.
	 */
	@SuppressWarnings("restriction")
	protected int getAssignmentType(){
		return 0;
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues#getExpectedRuntimeType()
	 */
	public  abstract CompositeType getExpectedRuntimeType() throws ELIsNotValidException;
}
